
class MyThread extends Thread{

    @Override
    public void run(){
        for (int i = 0; i < 10; i++) {
            //System.out.println(s);
            System.out.println(this.getName());
            try {
                sleep(1000);
            } catch (InterruptedException e) {
                throw new RuntimeException(e);
            }
        }
    }
}
public class demo4 {
    public static void main(String[] args) throws InterruptedException {
        /*Thread.sleep(1000);
        Thread t1=new MyThread();
        Thread t2=new MyThread();
        t1.start();

        t2.start();*/

        Thread t3=new Thread(()->{
            System.out.println(Thread.currentThread().getName()+"hhh");
        },"张三");
        t3.start();

    }
}
